n = (1:1000)';
s = sin(0.075*pi*n);

v = 0.8*randn(1000,1); % Random noise part.
ar = [1,1/2];          % Autoregression coefficients.
v1 = filter(1,ar,v);   % Noise signal. Applies a 1-D digital 
                       % filter.
                       
x = s + v1;

ma = [1, -0.8, 0.4 , -0.2];
v2 = filter(ma,1,v);

L = 7;
mu = 0.12/30;            % LMS step size.
hlms = adaptfilt.lms(7,mu);

[ylms,elms] = filter(hlms,v2,x);

plot(x,':');
hold on
plot(s,'r');
plot(elms,'g');
hold off

n = (1:5000)';
s = sin(0.075*pi*n);
nr = 25;
v = 0.8*randn(5000,nr);
v1 = filter(1,ar,v);
x = repmat(s,1,nr) + v1;
v2 = filter(ma,1,v);

M = 10; % Decimation factor
mselms = msesim(hlms,v2,x,M);
plot(1:M:n(end),mselms)